package com.ln.dm1107.demo01;

import java.lang.reflect.Parameter;
import java.time.*;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/11/7 15:55
 */
public class Test04 {
    public static void main(String[] args) {
        LocalDate of = LocalDate.of(2021, 11, 7);
        LocalDate now = LocalDate.now();
        //比较两个日期的距离
        Period between = Period.between(of, now);
        int years = between.getYears();
        int months = between.getMonths();
        int days = between.getDays();

        System.out.println(years);
        System.out.println(months);
        System.out.println(days);

        LocalTime of1 = LocalTime.of(11, 11, 11);
        LocalTime now1 = LocalTime.now();
        Duration between1 = Duration.between(of1, now1);
        long l = between1.toHours();
        long l1 = between1.toMinutes();
        long l2 = between1.getSeconds();
        System.out.println(l);
        System.out.println(l1);
        System.out.println(l2);
    }
}
